#!/usr/bin/python
# coding:utf-8
# auther:DT
# 2017-08-11_21-05-46
'''这是一个监控的cpu mem disk 
'''
import psutil

'''这是监控mem 的'''
mem = psutil.virtual_memory()
mem_bf = int(mem.total / mem.used)
if mem_bf >= 60:
    print("warning!!! %d 了" % mem_bf)
elif mem_bf >= 80:
    print("内存不足！！")
else:
    print(mem_bf)

'''这是监控cpu的'''
cpu = psutil.cpu_percent()
if cpu >= 80:
    print("cpu现在使用快爆表了 {}".format(cpu))
else:
    print(cpu)

'''这是监控disk的  /  和/boot  '''
for i in psutil.disk_partitions():
    print(i[1],"--->",psutil.disk_usage(i[1]).percent)
    if int(psutil.disk_usage(i[1]).percent) >= 60:
        print(i[1] ,"分区的空间不足",psutil.disk_usage(i[1]).percent)
    else:
        print(psutil.disk_usage(i[1]).percent)
